package string;

import ooday04.Animal;
import ooday04.Fish;

import javax.lang.model.element.NestingKind;

public class StringDemo {
    public static void main(String[] args) {
//        String s1="sfsdf";
//        String s2="sfsdf";
//        String s3="sfsdf";
//        String s4=new String("ssdf收款方");
//        System.out.println(s4.hashCode());
//        System.out.println(System.identityHashCode(s4));
      //  int ha=System.identityHashCode(s4);
  Animal fish=new Fish(4,"sf","");
          System.out.println(fish);
         int i=   System.identityHashCode(fish);
         String s=Integer.toHexString(i);
          System.out.println(s);
          int i2=fish.hashCode();
          String s2=Integer.toHexString(i2);
          System.out.println(s2);
//        System.out.println(Integer.toHexString(System.identityHashCode(s4)));

        String c0=new String("123abc");
        String c1="123abc";
        String c2="123"+"abc";
        String c3="123";
        String c4=c3+"abc";
        String c5="abc";
        String c6=c3+c5;
        System.out.println(c0==c1);
        System.out.println(c1==c2);
        System.out.println(c1==c4);
        System.out.println(c1==c6);

        System.out.println(c1.equals(c4));
        System.out.println(c1.equals(c6));
    }
}
